#include "stdafx.h"
#include "Warrior.h"
#include "Knight.h"
#include "Troll.h"
#include "Knife.h"
#include "Sward.h"


void Fight(std::auto_ptr<Warrior> left, std::auto_ptr<Warrior> right)
{
    std::shared_ptr<IWeaponBehaiver> knife(new Knife());
    std::shared_ptr<IWeaponBehaiver> sward(new Sward());

    left->SetWeapon(knife);
    right->SetWeapon(sward);
    
    left->Attack();
    right->Attack();

    left->SetWeapon(sward);
    right->SetWeapon(knife);

    left->Attack();
    right->Attack();
}

int _tmain(int argc, _TCHAR* argv[])
{
    std::auto_ptr<Warrior> knight(new Knight());
    std::auto_ptr<Warrior> troll(new Troll());
    Fight(knight, troll);
	return 0;
}

